'use strict';
const Service = require('egg').Service;
class UserService extends Service {

  // 获取用户邀请码
  async getUserInvitCode() {
    const { ctx } = this;
    const hashId = await ctx.genHash(ctx.state.user.id + ''); // 加密用户id
    return `?code=${hashId}`;
  }


  // return await app.model.User.findOne({ where, raw: true });
  // const checked = await ctx.compare(ctx.state.user.id + '', hashId);// 解密用户id

}

module.exports = UserService;
